<?php

/**
 * This is the model class for table "uc_user".
 *
 * The followings are the available columns in table 'uc_user':
 * @property string $user_id
 * @property string $mobile
 * @property string $password
 * @property string $user_sign
 * @property string $real_name
 * @property string $platform
 * @property string $deviceInfo
 * @property integer $sex
 * @property string $avatar
 * @property double $total_expense
 * @property double $balance
 * @property double $balance_withdrawing
 * @property double $balacan_cash
 * @property double $income_order
 * @property double $income_platform
 * @property double $income_purse
 * @property integer $is_push
 * @property integer $del_flag
 * @property integer $is_backcreate
 * @property string $create_time
 * @property integer $is_complete
 * @property string $last_ts
 * @property string $user_head
 * @property string $session_id
 * @property integer $is_delete
 * @property string $update_time
 * @property string $created_by
 * @property string $updated_by
 */
class UcUser extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return UcUser the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'uc_user';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('mobile, password, create_time', 'required'),
			array('sex, is_push, del_flag, is_backcreate, is_complete, is_delete', 'numerical', 'integerOnly'=>true),
			array('total_expense, balance, balance_withdrawing, balacan_cash, income_order, income_platform, income_purse', 'numerical'),
			array('mobile', 'length', 'max'=>60),
			array('password', 'length', 'max'=>100),
			array('user_sign', 'length', 'max'=>250),
			array('real_name', 'length', 'max'=>120),
			array('platform', 'length', 'max'=>50),
			array('last_ts', 'length', 'max'=>10),
			array('session_id, created_by, updated_by', 'length', 'max'=>255),
			array('deviceInfo, avatar, user_head, update_time', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('user_id, mobile, password, user_sign, real_name, platform, deviceInfo, sex, avatar, total_expense, balance, balance_withdrawing, balacan_cash, income_order, income_platform, income_purse, is_push, del_flag, is_backcreate, create_time, is_complete, last_ts, user_head, session_id, is_delete, update_time, created_by, updated_by', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'user_id' => 'User',
			'mobile' => 'Mobile',
			'password' => 'Password',
			'user_sign' => 'User Sign',
			'real_name' => 'Real Name',
			'platform' => 'Platform',
			'deviceInfo' => 'Device Info',
			'sex' => 'Sex',
			'avatar' => 'Avatar',
			'total_expense' => 'Total Expense',
			'balance' => 'Balance',
			'balance_withdrawing' => 'Balance Withdrawing',
			'balacan_cash' => 'Balacan Cash',
			'income_order' => 'Income Order',
			'income_platform' => 'Income Platform',
			'income_purse' => 'Income Purse',
			'is_push' => 'Is Push',
			'del_flag' => 'Del Flag',
			'is_backcreate' => 'Is Backcreate',
			'create_time' => 'Create Time',
			'is_complete' => 'Is Complete',
			'last_ts' => 'Last Ts',
			'user_head' => 'User Head',
			'session_id' => 'Session',
			'is_delete' => 'Is Delete',
			'update_time' => 'Update Time',
			'created_by' => 'Created By',
			'updated_by' => 'Updated By',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('user_id',$this->user_id,true);
		$criteria->compare('mobile',$this->mobile,true);
		$criteria->compare('password',$this->password,true);
		$criteria->compare('user_sign',$this->user_sign,true);
		$criteria->compare('real_name',$this->real_name,true);
		$criteria->compare('platform',$this->platform,true);
		$criteria->compare('deviceInfo',$this->deviceInfo,true);
		$criteria->compare('sex',$this->sex);
		$criteria->compare('avatar',$this->avatar,true);
		$criteria->compare('total_expense',$this->total_expense);
		$criteria->compare('balance',$this->balance);
		$criteria->compare('balance_withdrawing',$this->balance_withdrawing);
		$criteria->compare('balacan_cash',$this->balacan_cash);
		$criteria->compare('income_order',$this->income_order);
		$criteria->compare('income_platform',$this->income_platform);
		$criteria->compare('income_purse',$this->income_purse);
		$criteria->compare('is_push',$this->is_push);
		$criteria->compare('del_flag',$this->del_flag);
		$criteria->compare('is_backcreate',$this->is_backcreate);
		$criteria->compare('create_time',$this->create_time,true);
		$criteria->compare('is_complete',$this->is_complete);
		$criteria->compare('last_ts',$this->last_ts,true);
		$criteria->compare('user_head',$this->user_head,true);
		$criteria->compare('session_id',$this->session_id,true);
		$criteria->compare('is_delete',$this->is_delete);
		$criteria->compare('update_time',$this->update_time,true);
		$criteria->compare('created_by',$this->created_by,true);
		$criteria->compare('updated_by',$this->updated_by,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}